package com.ml.mall.model.mail.purchaser;

import com.ml.mall.model.MailMessage;
import org.springframework.stereotype.Component;

/**
 * @description 该类为买家提供邮件模板
 * @author pl
 * @date 2021/7/13
 * @version 1.0
*/
@Component
public class MailTemplateForPurchaser {


    /**
     * 订单支付通知，系统发送 “订单支付通知” 邮件给买家
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getPurchaseOrderPaymentMade(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Purchase order payment done");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                " <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                " <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "  <div style=\"width: 70%;\">\n" +
                "   <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "    Purchase order payment <span style=\"color: #54af9a;\">done</span>!\n" +
                "   </span>\n" +
                "  </div>\n" +
                " </div>\n" +
                " <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "  <p>Hi <strong>[ purchaser_name ],</strong></p>\n" +
                "  <br>\n" +
                "  <p>You have made a payment of <strong>[ purchase_order_amount ]</strong> for purchase order <strong>[ purchase_order_no ]</strong> with details as below:</p>\n" +
                "  [<div style=\"background-color: #EFF2F4\">\n" +
                "   <h4>Products</h4>\n" +
                "   <div class=\"supplier-products-info\">\n" +
                "    <div style=\"display: inline-block; width: 25%;\">\n" +
                "     <strong>[ supplier_name ]</strong>\n" +
                "    </div>\n" +
                "    <div style=\"display: inline-block;\">\n" +
                "     <strong>Status</strong> : [ delivery_status ]\n" +
                "    </div>\n" +
                "    <div style=\"display: inline-block;\">\n" +
                "     <strong>Delivery Date </strong> : [ delivery_date ]\n" +
                "    </div>\n" +
                "    <div style=\"display: inline-block;\">\n" +
                "     <strong>Tracking Code</strong> : [ tracking_code ]\n" +
                "    </div>\n" +
                "   </div>\n" +
                "   <div class=\"supplier-product-table\" style=\"padding-top: 20px; padding-bottom: 30px; border-bottom: solid 0.5px #D4DAE6;\">\n" +
                "    <table style=\"width: 100%; border-radius: 5px; border-collapse: collapse;\">\n" +
                "     <tr><th style=\"width: 15%; padding: 5px 10px;\">Image</th><th style=\"width: 40%;text-align: left;\">Product Name</th><th style=\"width: 10%;text-align: center;\">Quantity</th><th style=\"width: 15%;text-align: right;\">Unit Price</th><th style=\"width: 10%;text-align: right; padding-right: 10px;\">Total</th></tr>\n" +
                "     <tr style=\"background-color: #DCE5F2; border-radius: 10px;\">\n" +
                "      <td style=\"border: none; padding: 10px 0 10px 10px;\">\n" +
                "       <img src=\"..\" style=\"width: 75px; height: 75px;\">\n" +
                "      </td>\n" +
                "      <td style=\"border: none;\">\n" +
                "       [ product_name ]\n" +
                "      </td>\n" +
                "      <td style=\"border: none; text-align: center;\">\n" +
                "       [ quantity ]\n" +
                "      </td>\n" +
                "      <td style=\"border: none; text-align: right;\">\n" +
                "       <div style=\"padding-bottom: 5px;\">RM [ price ]</div>\n" +
                "       <div style=\"padding-bottom: 5px;\">RM [ sales_price ]</div>\n" +
                "       <div>RM [ uom ]</div>\n" +
                "      </td>\n" +
                "      <td style=\"border: none; text-align: right; padding-right: 10px;\">\n" +
                "       RM [ total ]\n" +
                "      </td>\n" +
                "     </tr>\n" +
                "     <tr style=\"border-radius: 10px;\">\n" +
                "      <td style=\"border: none; padding: 10px 0 10px 10px;\">\n" +
                "       <img src=\"..\" style=\"width: 75px; height: 75px;\">\n" +
                "      </td>\n" +
                "      <td style=\"border: none;\">\n" +
                "       [ product_name ]\n" +
                "      </td>\n" +
                "      <td style=\"border: none; text-align: center;\">\n" +
                "       [ quantity ]\n" +
                "      </td>\n" +
                "      <td style=\"border: none; text-align: right;\">\n" +
                "       <div style=\"padding-bottom: 5px;\">RM [ price ]</div>\n" +
                "       <div style=\"padding-bottom: 5px;\">RM [ sales_price ]</div>\n" +
                "       <div>RM [ uom ]</div>\n" +
                "      </td>\n" +
                "      <td style=\"border: none; text-align: right; padding-right: 10px;\">\n" +
                "       RM [ total ]\n" +
                "      </td>\n" +
                "     </tr>\n" +
                "     <tr style=\"border-radius: 10px; font-weight: bold;\">\n" +
                "      <td colspan=\"4\" style=\"text-align: right;\">\n" +
                "       <div>Delivery Fee (Delivered by [ logistic_company_name ]) :</div>\n" +
                "       <div style=\"padding: 5px\">\n" +
                "        <div style=\"display: inline-block; width: 100px; font-size: 13px; padding-left: 5px; float: right; vertical-align: middle; line-height: 30px;\">\n" +
                "         ([coupon_desc])\n" +
                "        </div>\n" +
                "        <div style=\"background-color: #2C84EA; border-radius: 5px; width: 100px; font-size: 13px; padding: 5px; float: right; display: inline-block;\">\n" +
                "         <span style=\"color: white;\">[coupon_name]</span>\n" +
                "         \n" +
                "        </div>\n" +
                "       </div>\n" +
                "      </td>\n" +
                "      <td style=\"text-align: right; font-size: 13px; padding-right: 10px; padding-bottom: 10px;\">\n" +
                "       <div class=\"delivery_fee\">\n" +
                "        RM [delivery_fee]\n" +
                "       </div>\n" +
                "       <div>\n" +
                "        - RM [coupon_fee]\n" +
                "       </div>\n" +
                "      </td>\n" +
                "     </tr>\n" +
                "    </table>\n" +
                "   </div>\n" +
                "  </div>\n" +
                "  <div style=\"background-color: #EFF2F4;padding-bottom: 20px;\">\n" +
                "   <table style=\"width: 100%; border-radius: 5px; border-collapse: collapse;\">\n" +
                "    <tr>\n" +
                "     <td style=\"width: 45%;text-align: left\">\n" +
                "      <div style=\"padding-bottom: 5px\">\n" +
                "       <span style=\"font-weight: bold;\">Delivery Note</span>\n" +
                "      </div>\n" +
                "      <div style=\"padding-bottom: 10px\">\n" +
                "       <textarea rows=\"5\" cols=\"60\" readonly style=\"border-radius: 5px; resize: none;\">[ delivery_note ]</textarea>\n" +
                "\n" +
                "      </div>\n" +
                "     </td>\n" +
                "     <th style=\"width: 55%; text-align: right;\">\n" +
                "      <table style=\"width: 100%; font-size:13px\">\n" +
                "       <tr>\n" +
                "        <td style=\"width: 25%; text-align: left;\">Sub total</td>\n" +
                "        <td style=\"width: 5%\">:</td>\n" +
                "        <td style=\"width: 45%\"></td>\n" +
                "        <td style=\"width: 25%;\">RM [sub_total]</td>\n" +
                "       </tr>\n" +
                "       <tr>\n" +
                "        <td style=\"width: 25%; text-align: left;\">Coupon</td>\n" +
                "        <td style=\"width: 5%\">:</td>\n" +
                "        <td style=\"width: 45%\">\n" +
                "         <div style=\"padding-bottom: 5px\">\n" +
                "         <div style=\"display: inline-block; width: 100px; font-size: 13px; padding-left: 5px; float: right; vertical-align: middle; line-height: 30px;\">\n" +
                "          ([coupon_desc])\n" +
                "         </div>\n" +
                "         <div style=\"background-color: #F5537F; border-radius: 5px; width: 100px; font-size: 13px; padding: 5px; float: right; display: inline-block;\">\n" +
                "          <span style=\"color: white;\">[coupon_name]</span>\n" +
                "         </div>\n" +
                "         </div>\n" +
                "        </td>\n" +
                "        <td style=\"width: 25%;\">- RM [coupon_amt]</td>\n" +
                "       </tr>\n" +
                "       <tr>\n" +
                "        <td style=\"width: 25%; text-align: left;\">Delivery Fee</td>\n" +
                "        <td style=\"width: 5%\">:</td>\n" +
                "        <td style=\"width: 45%\"></td>\n" +
                "        <td style=\"width: 25%;\">RM [delivery_fee]</td>\n" +
                "       </tr>\n" +
                "       <tr>\n" +
                "        <td style=\"width: 25%; text-align: left;\">Shipping Coupon</td>\n" +
                "        <td style=\"width: 5%\">:</td>\n" +
                "        <td style=\"width: 45%\"></td>\n" +
                "        <td style=\"width: 25%;\">- RM [shipping_coupon]</td>\n" +
                "       </tr>\n" +
                "       <tr>\n" +
                "        <td style=\"width: 25%; text-align: left;\">Adjustment</td>\n" +
                "        <td style=\"width: 5%\">:</td>\n" +
                "        <td style=\"width: 45%\"></td>\n" +
                "        <td style=\"width: 25%;\">RM [adjustment]</td>\n" +
                "       </tr>\n" +
                "       <tr>\n" +
                "        <td style=\"width: 25%; text-align: left;\">Credit</td>\n" +
                "        <td style=\"width: 5%\">:</td>\n" +
                "        <td style=\"width: 45%\"></td>\n" +
                "        <td style=\"width: 25%;\">- RM [sub_total]</td>\n" +
                "       </tr>\n" +
                "       <tr>\n" +
                "        <td style=\"width: 25%; text-align: left;\">Total (Incl. Tax)</td>\n" +
                "        <td style=\"width: 5%\">:</td>\n" +
                "        <td style=\"width: 45%\"></td>\n" +
                "        <td style=\"width: 25%;\">RM [total_amt]</td>\n" +
                "       </tr>\n" +
                "\n" +
                "      </table>\n" +
                "     </th>\n" +
                "    </tr>\n" +
                "   </table>\n" +
                "  </div>\n" +
                "  <br>\n" +
                "  <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "  <br>\n" +
                "\n" +
                "  <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "  <br>\n" +
                "  <p>Need help? Contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for enquiry.</p>\n" +
                "  <br>\n" +
                "  <p>Best regards,<br><strong>Airena Procure Team</strong></p>\n" +
                "  \n" +
                " </div>\n" +
                "</div>");

        return mailMessage;
    }

    /**
     * 卖家更新订单状态，系统发送 “卖家更新订单状态” 邮件给买家
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getDeliveryScheduleUpdatedByEachSupplier(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Delivery status has been updated");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
            "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                    "<img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                    "<div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                    "<div style=\"width: 70%;\">\n" +
                    "<span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                    "Supplier has started to  <span style=\"color: #54af9a;\">order_state</span> purchase order!\n" +
                    "</span>\n" +
                    "</div>\n" +
                    "</div>\n" +
                    "<div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                    "<p>Hi <strong>purchaser_name</strong>,</p>\n" +
                    "<br>\n" +
                    "<p>The order <strong>order_no</strong> part of goods status is changed.</p>\n" +
                    "<p>You may login into the system to view the details of the current status in the purchase order.</p>\n" +
                    "<a href=system_url style=\"background-color: #2C84EA; color: white; padding: 14px 25px; text-align: center; text-decoration: none; display: inline-block; border-radius: 12px;\">Login</a>\n" +
                    "<br>\n" +
                    "<p>Need help? Contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for enquiry.</p>\n" +
                    "<br>\n" +
                    "<p>Best regards,<br><strong>Airena Procure Team</strong></p>\n" +
                    "\n" +
                    "</div>\n" +
                    "</div>"
        );

        return mailMessage;
    }

    /**
     * 订单完成，系统发送 “订单完成” 邮件给买家
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getPurchaseOrderCompleted(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Purchase order completed");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                " <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                " <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "  <div style=\"width: 70%;\">\n" +
                "   <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "    Purchase order <span style=\"color: #54af9a;\">completed</span>!\n" +
                "   </span>\n" +
                "  </div>\n" +
                " </div>\n" +
                " <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "  <p>Hi <strong>purchaser_name</strong>,</p>\n" +
                "  <br>\n" +
                "  <p>Purchase order <strong>order_no</strong> has been completed as all of the products have been delivered.</p>\n" +
                "  <a href=system_url style=\"background-color: #2C84EA; color: white; padding: 14px 25px; text-align: center; text-decoration: none; display: inline-block; border-radius: 12px;\">View Order</a>\n" +
                "  <br>\n" +
                "  <p>Need help? Contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for enquiry.</p>\n" +
                "  <br>\n" +
                "  <p>Best regards,<br><strong>Airena Procure Team</strong></p>\n" +
                "  \n" +
                " </div>\n" +
                "</div>");

        return mailMessage;
    }

//    todo :优惠券是运营发送的；系统不知优惠券什么时候过期
    /**
     * 优惠卷过期通知，系统发送 “优惠卷过期通知” 邮件给买家
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getCouponExpirationReminder(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Coupon expired soon");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                " <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                " <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "  <div style=\"width: 70%;\">\n" +
                "   <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "    Your coupon <span style=\"color: #54af9a;\">coupon_name</span> is going to expire soon!\n" +
                "   </span>\n" +
                "  </div>\n" +
                " </div>\n" +
                " <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "  <p>Hi <strong>purchaser_name</strong>,</p>\n" +
                "  <br>\n" +
                "  <p>We are here to remind you that coupon <strong>coupon_name</strong>is going to expire soon and we hope you can enjoy the deal before time runs out!</p>\n" +
                // "  <a href= system_url style=\"color: #2c84ea; font-weight: bold;\"> system_url </a>\n" +
                "  <br>\n" +
                "  <p>Need help? Contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for enquiry.</p>\n" +
                "  <br>\n" +
                "  <p>Best regards,<br><strong>Airena Procure Team</strong></p>\n" +
                " </div>\n" +
                "</div>");

        return mailMessage;
    }


    /**
     * 用户邀请链接，通用
     * @param to 收件人邮箱
     * @return
     */
    public MailMessage getUserInvitation(String to){

        MailMessage mailMessage = new MailMessage();
        //设置模板标题
        mailMessage.setSubject("Invitation to join Airena Procure");
        mailMessage.setReceiverEmail(to);
        mailMessage.setContent(
                "<div style=\"width: 1000px; margin: auto; text-align: left;font-family: 'Helvetica', sans-serif;\">\n" +
                " <img src=mainPicUrl style=\"width: 100%; height: 200px; margin: -8px;\">\n" +
                " <div style=\"border-bottom: solid 0.5px #e1e6ed; padding-bottom: 50px; width: 90%; margin: auto;\">\n" +
                "  <div style=\"width: 70%;\">\n" +
                "   <span style=\"font-weight: bold; font-size: 32pt; color: #06375b;\">\n" +
                "    You are invited to join <span style=\"color: #54af9a;\">Airena Procure</span> !\n" +
                "   </span>\n" +
                "  </div>\n" +
                " </div>\n" +
                " <div style=\"width: 90%; margin: auto; padding-top: 20px;\">\n" +
                "  <p>Hi <strong>user_name</strong>,</p>\n" +
                "  <br>\n" +
                "  <p>You are invited to register as one of the users under company <strong>company_name</strong>.</p>\n" +
                "  <p>Please click on the link below to login</p>\n" +
                "  <p>account: <strong> email_acc </strong>.</p>\n" +
                "  <p>password: <strong> user_password </strong>.</p>\n" +
                "  <a href=system_url style=\"background-color: #2C84EA; color: white; padding: 14px 25px; text-align: center; text-decoration: none; display: inline-block; border-radius: 12px;\">Login</a>\n" +
                "  <br>\n" +
                "  <p>Need help? Contact <strong>contact_no</strong> or send email to <strong> general_email </strong> for enquiry.</p>\n" +
                "  <br>\n" +
                "  <p>Best regards,<br><strong>Airena Procure Team</strong></p>\n" +
                "  \n" +
                " </div>\n" +
                "</div>");

        return mailMessage;
    }


}
